<?php

namespace App\Transformers;

use App\Models\Egress;

class EgressTransformer extends Transformer
{
    /**
     * @param Egress $egress
     * @return array
     */
    public function transform(Egress $egress)
    {
        return [
            'id'    => $egress->id,
            'name'  => $egress->users->name,
            'department_name'  => $egress->users->department->name,
            'dates' => $egress->dates,
            'start_time' => $egress->start_time,
            'end_time' => $egress->end_time,
            'min' => $egress->end_time-$egress->start_time,
            'work_place' => $egress->work_place,
            'work_content' => $egress->work_content,
        ];
    }
}
